<template>
	<view class="indexPage">
		<view class="top">
			<view class="logo">
				<image src="@/static/images/shangpin/logo.png"></image>
			</view>
			<view class="icon">
				<image src="@/static/images/shangpin/icon4.png"></image>
			</view>
		</view>
		<scroll-view scroll-y="true" :style="{ height: scrollViewHeight + 'px' }">
			<view class="functionList">
				<view class="functionItem" v-for="(item,index) in dataList" :key="index" @click="goShanp(index,item)">
					<!-- <image :src="item.iconBg" class="itemBg"></image> -->
					<view class="contentBox">
						<image :src="item.icon" class="icon"></image>
						<view class="center">
							<view class="name">{{item.name}}</view>
							<view class="english">{{item.text}}</view>
						</view>
						<image src="@/static/images/newIndex/jt.png" class="itemBg"></image>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				windowHeight: 0,
				navTop: 0, //距离顶部高度
				scrollViewHeight: 0, //可滚动剩余高度
				dataList: [{
						name: 'YLD/购买专区',
						text: '更多优惠活动，让您放心选择',
						icon: '/static/images/shangpin/index.png'
					},
					// {
					// 	name: 'YLD+UT购买',
					// 	text: '更多的商家，让您放心选择'
					// },
					// {
					// 	name: 'UT直接购买',
					// 	text: '更多的商家，让您放心选择'
					// },
					{
						name: 'YLD/现金专区',
						text: '更多优惠活动，让您放心选择',
						icon: '/static/images/shangpin/index1.png'
					},
					{
						name: '现金专区',
						text: '更多优惠活动，让您放心选择',
						icon: '/static/images/shangpin/index2.png'
					},
					{
						name: '附近商家',
						text: '更多的商家，让您放心选择',
						icon: '/static/images/shangpin/index3.png'
					}
				],
			}
		},
		onShow() {

		},
		onLoad() {},
		onReady() {
			var wanlsys = this.$wanlshop.wanlsys();
			this.windowHeight = wanlsys.windowHeight;
			let _self = this
			let view = uni.createSelectorQuery().select('.functionList')
			view.boundingClientRect(data => {
				_self.navTop = data.top
				_self.scrollViewHeight = _self.windowHeight - data.top
			}).exec()
		},
		methods: {
			goShanp(val, item) {
				if (val == 0) {
					this.$wanlshop.to(`/pages/product/category?id=1&name=${item.name}`);
				} else if (val == 1) {
					this.$wanlshop.to(`/pages/product/category?id=2&name=${item.name}`);
				} else if (val == 2) {
					this.$wanlshop.to(`/pages/product/category?id=3&name=${item.name}`);
				} else {
					this.$wanlshop.to("/pages/shop/list");
				}
			}
		}
	}
</script>
<style lang="scss">
	page {
		background: linear-gradient(180deg, #C93E34 0%, #CF403A 52%, #FFF9F4 100%);
		background-attachment: fixed;
	}

	.indexPage {
		position: relative;
		// overflow: hidden;
		background: linear-gradient(180deg, #C93E34 0%, #CF403A 52%, #FFF9F4 100%);
		background-attachment: fixed;
	}

	.top {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx 0 0 60rpx;

		.logo {
			width: 364rpx;
			height: 108rpx;


		}

		.icon {
			width: 286rpx;
			height: 288rpx;
		}

		uni-image {
			width: 100%;
			height: 100%;
		}
	}

	.indexBg {
		width: 100%;
		height: 328rpx;
		position: absolute;
		top: 0;
		z-index: 1;
	}

	.bannerBox {}

	.functionList {
		margin: 10rpx 28rpx;

		.functionItem {
			position: relative;
			background: linear-gradient(90deg, #FFF9F4 0%, #FBEEE9 100%);
			box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.01);
			border-radius: 10rpx;
			overflow: hidden;
			margin-bottom: 30rpx;
			border-radius: 24rpx;
			border: 2rpx solid #EDD5C6;

			.itemBg {
				position: absolute;
				width: 48rpx;
				height: 48rpx;
				right: 48rpx;
			}

			.contentBox {
				position: relative;
				padding: 48rpx;
				z-index: 3;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.icon {
					width: 80rpx;
					height: 80rpx;
				}

				.center {
					flex: 1;
					width: 0;
					margin-left: 32rpx;

					.name {

						font-weight: 500;
						font-size: 30rpx;
						color: #672918;
						line-height: 42rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;

					}

					.english {
						width: 450rpx;
						font-size: 22rpx;
						color: #A28C8C;
						line-height: 32rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;

					}
				}
			}
		}
	}
</style>